<template>
  <div class="box">
    <div class="top">
      <p class="title">实时游客统计</p>
      <p class="right">可预约总量<span>9999</span>人</p>
    </div>
    <div class="peopleNum">
      <span v-for="(item,index) in peopleNum" :key="index">{{ item }}</span>
    </div>
    <!--盒子：将来：echarts展示图形的水球图-->
    <div class="charts" ref="EchartsVc">123</div>
  </div>
</template>

<script setup lang="ts">
import {ref, onMounted} from "vue";
//引入echarts
import * as echarts from 'echarts';
import 'echarts-liquidfill';//水球图拓展插件


let peopleNum = ref<string>('216908人')
let EchartsVc = ref<any>();//拿到dom节点

onMounted(() => {
  //获取echarts类实例
  let mycharts = echarts.init(EchartsVc.value);
  //设置实例的配置项
  mycharts.setOption({
    //标题组件
    title: {
      text: '水球图',
    },
    //x|y轴组件
    xAxis: {},
    yAxis: {},
    //系列：决定展示什么样的图形图标
    series: {
      type: 'liquidFill',
      data: [0.6],//数据
      radius:'95%',//半径
      outline:{
        show:true,
        borderDistance:8,
        itemStyle:{
        }
      }

    },
    //布局组件
    grid: {
      left: 0,
      right: 0,
      top: 0,
      bottom: 0
    }
  })
})

</script>

<style scoped lang="scss">
.box {
  background: rgba(71, 86, 105, 0.57);
  margin-top: 10px;

  .top {
    .title {
      color: white;
      margin-left: 20px;
      font-size: 20px;
      margin-top: 20px;
    }

    .right {
      float: right;
      font-size: 20px;
      color: white;
      margin-right: 10px;

      span {
        color: yellowgreen;
      }
    }
  }

  .peopleNum {
    margin-top: 30px;
    height: 80px;
    display: flex;
    padding: 0 20px;

    span {
      flex: 1;
      text-align: center;
      line-height: 80px;
      font-size: 45px;
      background: rgba(168, 178, 177, 0.35);
    }
  }

  .charts {
    width: 100%;
    margin-top: 10px;
    height: 220px;
  }
}
</style>